<?php
class Contact_Form_Item_ValidatePicture{
	
	public static function validate($arrParam = null, $options = null){
		/*=======================================================
		 * Start - validate name
		 *=======================================================*/	
		$upload 	= new Zend_File_Transfer_Adapter_Http();	
		$fileInfo 	= $upload->getFileInfo('picture');
		$fileName 	= $fileInfo['picture']['name'];
		
		if(!empty($fileName)){
			$options = array('gif','png','jpg');
			$upload->addValidator('Extension',true,$options,'picture')
			 	   ->addValidator('Size',true,array('min'=>'1kb','max'=>'1000kb'),'picture')
				   ->addValidator('ImageSize',true,
									array('minwidth'=>110,'minheight'=>110,
										'maxwidth'=>800,'maxheight'=>800),
									'picture');
			if(!$upload->isValid('picture')){
				$message 	= $upload->getMessages();
				$error 		= current($message);							
			}
		}
		return $error;	
	}
	
}